﻿using Abp.Dependency;
using Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace DevM.Development.ReleaseRecords
{
    public class ReleaseRecordStore : ITransientDependency
    {
        private readonly IRepository<ReleaseRecord, long> releaseRecordRepository;

        public ReleaseRecordStore(IRepository<ReleaseRecord, long> releaseRecordRepository)
        {
            this.releaseRecordRepository = releaseRecordRepository;
        }

        /// <summary>
        /// 新增发布记录
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        public async Task<ReleaseRecord> AddReleaseRecord(long? creatorUserId,long projectId,int? tenantId)
        {
            return await releaseRecordRepository.InsertAsync(new ReleaseRecord
            {
                ProjectId = projectId,
                TenantId = tenantId,
                CreationTime = DateTime.Now,
                CreatorUserId = creatorUserId
            });
        }
    }
}
